package com.gpframework.module.module.domain.req;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gpframework.common.utils.StringUtils;
import com.gpframework.module.base.domain.req.BaseReq;
import com.gpframework.module.module.domain.PlatformSales;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.util.Date;
import java.math.BigDecimal;

/**
 * @ClassName PlatformSalesReq
 * @Author gpframework
 * @Date 2022-05-09
 * @Version 1.0.0
 * @Description 列表查询信息体
 */
@Data
@ToString
@EqualsAndHashCode
@NoArgsConstructor
@Accessors(chain = true)
public class PlatformSalesReq extends BaseReq {
    private static final long serialVersionUID = 1L;

         @ApiModelProperty("id")
     private Long salesId;
     @ApiModelProperty("微信号")
     private String wechatCode;
     @ApiModelProperty("用户编号;员工工号")
     private String userCode;
     @ApiModelProperty("昵称")
     private String nickname;
     @ApiModelProperty("性别")
     private String sex;
     @ApiModelProperty("名称")
     private String name;
     @ApiModelProperty("头像url")
     private String headImage;
     @ApiModelProperty("区域id")
     private Long areaId;
     @ApiModelProperty("详细住址")
     private String address;
     @ApiModelProperty("手机号")
     private String phone;
     @ApiModelProperty("身份证号")
     private String idNumber;
     @ApiModelProperty("生日")
     private Date birthday;
     @ApiModelProperty("邮箱")
     private String email;
     @ApiModelProperty("简介")
     private String synopsis;
     @ApiModelProperty("状态;有效、无效、离职")
     private String status;
     @ApiModelProperty("排序")
     private Integer sort;
     @ApiModelProperty("备注")
     private String remarks;
     @ApiModelProperty("创建人")
     private String createBy;
     @ApiModelProperty("创建时间")
     private Date createTime;
     @ApiModelProperty("更新者")
     private String updateBy;
     @ApiModelProperty("更新时间")
     private Date updateTime;
     @ApiModelProperty("删除标记;0未删除。1已删除。")
     private Integer delStatus;

    /**
    * @Description 生成查询wrapper
    * @Author greatplan@qq.com
    * @Date 2020-11-04 16:04
    * @Param [lqw]
    * @Param [isVO] 是否vo查询体，true的话走的是mapper.xml里面的查询语句，不过查询语法还是mybatis-plus，主要用于某些关联查询出一些非数据表字段
    * @Return void
    */
    public void generatorQuery(QueryWrapper<PlatformSales> lqw,boolean isVo) {
        String alias = "";
        if (isVo) {
            alias = "gp.";
            lqw.eq(alias+"del_status",0);
        }
        if (this.getSalesId() != null){
        lqw.eq(alias+"sales_id" ,this.getSalesId());
        }
        if (StringUtils.isNotBlank(this.getWechatCode())){
        lqw.eq(alias+"wechat_code" ,this.getWechatCode());
        }
        if (StringUtils.isNotBlank(this.getUserCode())){
        lqw.eq(alias+"user_code" ,this.getUserCode());
        }
        if (StringUtils.isNotBlank(this.getNickname())){
            lqw.like(alias+"nickname",this.getNickname());
        }
        if (StringUtils.isNotBlank(this.getSex())){
        lqw.eq(alias+"sex" ,this.getSex());
        }
        if (StringUtils.isNotBlank(this.getName())){
            lqw.like(alias+"name",this.getName());
        }
        if (StringUtils.isNotBlank(this.getHeadImage())){
        lqw.eq(alias+"head_image" ,this.getHeadImage());
        }
        if (this.getAreaId() != null){
        lqw.eq(alias+"area_id" ,this.getAreaId());
        }
        if (StringUtils.isNotBlank(this.getAddress())){
        lqw.eq(alias+"address" ,this.getAddress());
        }
        if (StringUtils.isNotBlank(this.getPhone())){
        lqw.eq(alias+"phone" ,this.getPhone());
        }
        if (StringUtils.isNotBlank(this.getIdNumber())){
        lqw.eq(alias+"id_number" ,this.getIdNumber());
        }
        if (this.getBirthday() != null){
        lqw.eq(alias+"birthday" ,this.getBirthday());
        }
        if (StringUtils.isNotBlank(this.getEmail())){
        lqw.eq(alias+"email" ,this.getEmail());
        }
        if (StringUtils.isNotBlank(this.getSynopsis())){
        lqw.eq(alias+"synopsis" ,this.getSynopsis());
        }
        if (StringUtils.isNotBlank(this.getStatus())){
        lqw.eq(alias+"status" ,this.getStatus());
        }
        if (this.getSort() != null){
        lqw.eq(alias+"sort" ,this.getSort());
        }
        if (StringUtils.isNotBlank(this.getRemarks())){
        lqw.eq(alias+"remarks" ,this.getRemarks());
        }
        if (StringUtils.isNotBlank(this.getCreateBy())){
        lqw.eq(alias+"create_by" ,this.getCreateBy());
        }
        if (this.getCreateTime() != null){
        lqw.eq(alias+"create_time" ,this.getCreateTime());
        }
        if (StringUtils.isNotBlank(this.getUpdateBy())){
        lqw.eq(alias+"update_by" ,this.getUpdateBy());
        }
        if (this.getUpdateTime() != null){
        lqw.eq(alias+"update_time" ,this.getUpdateTime());
        }
        if (this.getDelStatus() != null){
        lqw.eq(alias+"del_status" ,this.getDelStatus());
        }
    }
}
